-
Notifications
You must be signed in to change notification settings - Fork 1.8k
plugins: fix compilation if FLB_SQLDB (sqlite3) is disabled #10239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
plugins: fix compilation if FLB_SQLDB (sqlite3) is disabled #10239
Conversation
4b2f2ad to
a767a54
Compare
|
Let's make sure this compiles for all existing targets as well. Would it be better to disable the features within the plugins that need the DB rather than the whole plugin @leonardo-albertovich ? It feels a bit like a large hammer, e.g. no tail input even if you don't use db. We would have to make the config options and any other usage conditional though so it may be worse. |
How can it not? Currently, FLB_SQLDB is enabled by default, and will stay like that. The problem is the other way around, if not enabled, then compilation breaks.
For me fine, but I would do that on a per feature basis. Perhaps just continue with this PR, and then fine-tune some features that might compile with some small fixups. In general, it would be much better if all options are toggled in the automated tests, on one reference compilation system. Perhaps even by incremental builds. But either way, I just want to fix compilation now. |
a767a54 to
8cf7987
Compare
8cf7987 to
7092bc1
Compare
|
@patrick-stephens @edsiper I changed this PR so that plugins are still compiled, but without database support. I hope this answers #10239 (comment). Tested by doing this: and |
|
Not sure if the CI failure is relevant or something else |
I just added |
7092bc1 to
24532cd
Compare
Signed-off-by: Thomas Devoogdt <[email protected]>
Signed-off-by: Thomas Devoogdt <[email protected]>
Signed-off-by: Thomas Devoogdt <[email protected]>
…B_HAVE_SQLDB Signed-off-by: Thomas Devoogdt <[email protected]>
Signed-off-by: Thomas Devoogdt <[email protected]>
Signed-off-by: Thomas Devoogdt <[email protected]>
a574d8a to
80cd590
Compare
Branch is rebased, remaining coderabbitai remarks are fixed. Can you merge it now? |
|
I think in_blob, flb_blob_db must be disabled if sqlite is not available, since they must have the state. Out S3 and out_azure will need to be aware of the lack of flb_blob_db so they can disable blob handling support |
But why do I then see a bunch of other FLB_HAVE_SQLDB declaratives in flb_blob_db? e.g. fluent-bit/plugins/in_blob/blob.c Line 641 in ed06c31
If it has to be disabled, do you expect me to drop all existing FLB_HAVE_SQLDB declaratives? Because I somehow expect that the original code should just compile, but was somehow broken over time. What I try to fix now. |
|
That's of course as far as I know and as a side note, the test case issue is unrelated to this feature because it's |
Then I don't touch anything. I would appreciate that this can just be merged then. Thanks for the review! |
|
Oh no, I didn't review the PR, I just clarified how things worked originally and what the CI issue was. |
leonardo-albertovich
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a minor nitpick but overall it's good to go.
I think replicating the flb_blob_db mechanism where the functions are defined but all of them return a specific error in azure_blob_db.c would make more sense than adding most of the pre-processor conditionals in the callers but TBH that component as a whole should be replaced by flb_blob_db which is the reason why the functionality was extracted instead of implemented in out_s3 originally so I don't think it'd be reasonable to get too pedantic here.
| return FLB_OK; | ||
| } | ||
|
|
||
| #ifdef FLB_HAVE_SQLDB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this function wrapped by this conditional when it only executes an HTTP call?
Also, this function wouldn't be called because cb_azb_blob_file_upload would exit prematurely due to ctx->db being set to NULL
| flb_plg_error(ctx->ins, "could not generate block id"); | ||
| flb_free(generated_random_string); | ||
| cfl_sds_destroy(ref_name); | ||
| flb_sds_destroy(ref_name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is correct.
The only thing is bundling this fix with the FLB_SQLDB patch means it could slip through the cracks and not make it to the other branch that should receive the same patch.
I'm not saying you have to create a new PR, it's more of an internal note.
| } | ||
|
|
||
| pthread_mutex_init(&ctx->file_upload_commit_file_parts, NULL); | ||
| #endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This conditional should be one line before, even though file_upload_commit_file_parts is used by a function that will exit prematurely there's no reason not to initialize it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See 6df3149, file_upload_commit_file_parts is excluded by FLB_HAVE_SQLDB. So it doesn't make sense to suddenly move it just for the purpose of initializing it.
|
moving this until the next milestone, some parts are still moving |
Fixes:
Summary by CodeRabbit
New Features
Bug Fixes
Tests